//package com.demo.service;
//
//import com.mongodb.Block;
//import com.mongodb.client.*;
//import com.mongodb.client.model.Sorts;
//import org.bson.BsonInt64;
//import org.bson.Document;
//import org.bson.conversions.Bson;
//import org.noear.solon.annotation.Inject;
//import org.noear.solon.extend.aspect.annotation.Service;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//
//@Service
//public class TestService {
//
//
//    @Inject
//    MongoClient mongoClient;
//    @Inject
//    MongoDatabase mongoDatabase;
//    @Inject("${mongodb.uri}")
//    private String uri;
//    public List query1() {
//        MongoCollection<HashMap> collection = mongoDatabase.getCollection("Hindi-WY-mark-20210731", HashMap.class);
//
//        Bson query = new Document("labelStatus", new BsonInt64(5));
//        collection.find(query)
////                .sort(Sorts.descending("qty"))
//                .skip(1000)
//                .forEach((Block<? super HashMap>) doc -> System.out.println(doc.toString()));
//        return null;
//    }
//    public List query2() {
//        MongoClient mongoClient2 = MongoClients.create(uri);
//        MongoDatabase mongoDatabase2 = mongoClient2.getDatabase("tasks");
////        MongoCollection<HashMap> collection = mongoDatabase2.getCollection("Hindi-WY-mark-20210731", HashMap.class);
//        MongoCollection<HashMap> collection = mongoDatabase2.getCollection("col_Vietnamese_20210425_1-mark-20210605", HashMap.class);
//
//        Bson query = new Document("markerId", new BsonInt64(6194));
//        collection.find(query)
//                .sort(Sorts.descending("qty"))
//                .skip(1000)
//                .forEach((Block<? super HashMap>) doc -> System.out.println(doc.toString()));
//        return null;
//    }
//    public List query3() {
//        MongoClient mongoClient2 = MongoClients.create(uri);
//        MongoDatabase mongoDatabase2 = mongoClient2.getDatabase("tasks");
//
//        MongoCollection<HashMap> collection = mongoDatabase2.getCollection("Hindi-WY-mark-20210731", HashMap.class);
////        Bson query = new Document("labelStatus", new BsonInt64(5));
//        Bson query = new Document("markerId", new BsonInt64(6194));
//
//        FindIterable findIterable = collection.find(query);
//        System.out.println(findIterable.cursor());
////        Document doc = collection.find(Filters.eq("labelStatus", "5")).first();
//        List<HashMap> maps = new ArrayList<>();
//        collection.find(query).into(maps);
//        System.out.println("maps: "+maps.toString());
//        System.out.println("Connected successfully to server.");
//        return maps;
//    }
//}
